<template>
    <section>
      <el-carousel :interval="6000" type="card" height="400px">
        <el-carousel-item v-for="(item,index) in bannerList" :key="index">
          <el-row>
            <el-col :span="10">
              <img :src="item.v_cover" class="cover"/>
            </el-col>
            <el-col :span="14">
              <h2 style="color: #fff;">{{item.v_title}}</h2>
              <div class="dec">
                {{item.v_introduction}}
              </div>
              <el-button type="primary" icon="el-icon-caret-right" class="play" @click="toVideoMsg(item.v_id)" round>播放影片</el-button>
            </el-col>
          </el-row>
        </el-carousel-item>
      </el-carousel>
    </section>
</template>

<script>
    export default {
        name: "home-banner",
        props:{
            bannerList:{
                Type:Array,
                default:[]
            }
        },
        data(){
            return{
            };
        },
        mounted() {
            for (var i = 0;i<this.bannerList.length;i++){
                this.bannerList[i].v_introduction = this.bannerList[i].v_introduction.replace(/\\n/gm,"\n")
            }
        },
        methods:{
            toVideoMsg:function (id) {
                this.$router.push({ path:'/videoMsg?id='+id})
            }
        }
    }
</script>

<style scoped>

  .el-carousel__item{
    background-color: #13151f;
    box-shadow: 0 0 20px #000000;
    /*考虑浏览器兼容性*/
    -moz-box-shadow: 0 0 20px #000000;
    -webkit-box-shadow: 0 0 20px #000000;
    border-radius: 5px;
    text-align: left;
    white-space: pre-line;
  }

  .cover{
    width: 240px;
    height: 350px;
    margin: 22px;
    transform-style: preserve-3d;
    box-shadow: 0 0 10px #000000;
    /*考虑浏览器兼容性*/
    -moz-box-shadow: 0 0 10px #000000;
    -webkit-box-shadow: 0 0 10px #000000;
    overflow: visible;
    display: block;
  }

  .dec{
    width: 100%;
    height: 223px;
    color: #fff;
    font-size: 6px;
    /*white-space: pre-line;*/
    margin-top: -20px;
    overflow: hidden;
    text-overflow:ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 13;
  }

  .play{
    width: 200px;
    margin-top: 40px;
    background-color: #d88930;
    border: none;
  }
</style>
